package com.untrance.shop.model;

import com.google.appengine.api.datastore.Key;
import com.untrance.shop.common.enums.UserRole;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @author eugene zadyra
 */
@Entity
public class User extends MainEntity {

    private String firstName;
    private String lastName;
    @Temporal(TemporalType.DATE)
    @Column(nullable=true)
    private Date birthDate;
    @OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST, optional=true)
    private Delivery deliveryAddress;
    @OneToOne(fetch=FetchType.LAZY, cascade=CascadeType.PERSIST, optional=false)
    private Contact contactInfo;
    private List<Key> commentKeys;
    private String username;
    private String password;
    private boolean locked;
    private boolean enabled;
    private UserRole userRole;
    
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public boolean isLocked() {
		return locked;
	}
	public void setLocked(boolean locked) {
		this.locked = locked;
	}
	public boolean isEnabled() {
		return enabled;
	}
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public void setBirthDate(Date birthDate) {
		this.birthDate = birthDate;
	}
	public Date getBirthDate() {
		return birthDate;
	}
	public Delivery getDeliveryAddress() {
		return deliveryAddress;
	}
	public void setDeliveryAddress(Delivery deliveryAddress) {
		this.deliveryAddress = deliveryAddress;
	}
	public Contact getContactInfo() {
		return contactInfo;
	}
	public void setContactInfo(Contact contactInfo) {
		this.contactInfo = contactInfo;
	}
	public void setCommentKeys(List<Key> commentKeys) {
		this.commentKeys = commentKeys;
	}
	public List<Key> getCommentKeys() {
		return commentKeys;
	}
	public void setUserRole(UserRole userRole) {
		this.userRole = userRole;
	}
	public UserRole getUserRole() {
		return userRole;
	}
}
